<?php
declare(strict_types=1);
namespace Field;

class AuthKeywordCateConst
{
    public const pk='';
    public const index=['KeyWordID','KeyWordCID'];
	public const fields=['KeyWordID','KeyWordCID','ClickThroughRate','ClickHitsRatio','Ymd'];
	public const comment=['KeyWordID'=>'关键词ID','KeyWordCID'=>'关键词分类ID','ClickThroughRate'=>'点击人数占比','ClickHitsRatio'=>'点击率','Ymd'=>''];
	/*
    * @Field KeyWordID
    * @Type bigint(11)
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 关键词ID
    */
    public const KeyWordID = 'KeyWordID';
    /*
    * @Field KeyWordCID
    * @Type bigint(11)
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 关键词分类ID
    */
    public const KeyWordCID = 'KeyWordCID';
    /*
    * @Field ClickThroughRate
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 点击人数占比
    */
    public const ClickThroughRate = 'ClickThroughRate';
    /*
    * @Field ClickHitsRatio
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 点击率
    */
    public const ClickHitsRatio = 'ClickHitsRatio';
    /*
    * @Field Ymd
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Ymd = 'Ymd';
}

class AuthKeywordCateColumns
{
public  int $KeyWordID;
   public  int $KeyWordCID;
   public  int $ClickThroughRate=0;
   public  int $ClickHitsRatio=0;
   public  int $Ymd=0;
	public function toArray():array
	{
		return [
'KeyWordID'=>$this->KeyWordID,
    'KeyWordCID'=>$this->KeyWordCID,
    'ClickThroughRate'=>$this->ClickThroughRate,
    'ClickHitsRatio'=>$this->ClickHitsRatio,
    'Ymd'=>$this->Ymd,        ];
	}
}

class AuthKeywordCateRow
{
	public AuthKeywordCateColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'KeyWordID' => $this->data->KeyWordID,
        'KeyWordCID' => $this->data->KeyWordCID,
        'ClickThroughRate' => $this->data->ClickThroughRate,
        'ClickHitsRatio' => $this->data->ClickHitsRatio,
        'Ymd' => $this->data->Ymd, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new AuthKeywordCateColumns();
        isset($data['KeyWordID']) && $this->data->KeyWordID = (int)$data['KeyWordID'];
           isset($data['KeyWordCID']) && $this->data->KeyWordCID = (int)$data['KeyWordCID'];
           isset($data['ClickThroughRate']) && $this->data->ClickThroughRate = (int)$data['ClickThroughRate'];
           isset($data['ClickHitsRatio']) && $this->data->ClickHitsRatio = (int)$data['ClickHitsRatio'];
           isset($data['Ymd']) && $this->data->Ymd = (int)$data['Ymd'];
    }
}
?>